<template>
	<view class="wanl-money">
		<wanl-navbar :isBack="true" :background="{background: '#fff',}" :showGongNeng="true">
			<text slot="content" style="color: #000; width: 100%;padding-left: 20rpx;">
				{{name}}
			</text>
		</wanl-navbar>
		<view class="top">
			<view class="logo" v-if="id=='1'">
				<image src="@/static/images/index/logo1.png"></image>
				<view class="wz">更多优惠活动，让您放心选择</view>
			</view>
			<view class="logo1" v-else-if="id=='2'">
				<image src="@/static/images/index/yld.png"></image>
			</view>
			<view class="logo1" v-else-if="id=='3'">
				<image src="@/static/images/index/xj.png"></image>
			</view>
			<view class="icon">
				<image src="@/static/images/index/gwc.png"></image>
			</view>
		</view>
		<view class="product_list">
			<view class="list" v-for="(item,index) in dataList">
				<view class="title" @click="more(item,)">
					{{item.name}}
					<span>更多<u-icon name="arrow-right" size="10"></u-icon></span>
				</view>
				<view class="goods_list">
					<view v-for="(product,index) in item.goods_list" class="goods_list_img">
						<image :src="product.image"></image>
						<view>{{tag}}{{product.price}}</view>
						<view v-if="product.yld_price>0">Y{{product.yld_price}}</view>
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				id: '',
				name: '',
				tag: '$'
			};
		},


		onLoad(option) {
			this.id = option.id
			this.name = option.name
			this.init()
			if (this.id == 1) {
				this.tag = 'Y'
			}
		},

		methods: {
			init() {
				uni.request({
					url: "/index/wanlshopCategory",
					method: "POST",
					data: {
						yld_type: this.id,
					},
					success: (res) => {
						if (res.res.code == 1) {
							this.dataList = res.data
						}
					},

				});
			},
			more(val) {
				this.$wanlshop.to(`/pages/product/goodsList?id=${val.id}&name=${val.name}&type=${this.id}`);
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: linear-gradient(180deg, #ffbab6 0%, #fed7d5 46%, rgba(221, 239, 255, 0) 100%);
		background-attachment: fixed;
		height: 100vh;
	}

	.top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 30rpx 0 60rpx;

		.logo {
			width: 336rpx;
			height: 46rpx;

			.wz {
				font-size: 24rpx;
				color: #2F3130;
			}

		}

		.logo1 {
			width: 338rpx;
			height: 114rpx;

		}

		.icon {
			width: 250rpx;
			height: 196rpx;
		}

		uni-image {
			width: 100%;
			height: 100%;
		}
	}

	.product_list {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		align-items: center;
		margin: 0 20px;
		padding-top: 10px;

		.list {
			padding: 32rpx 20rpx 26rpx 20rpx;
			width: 49%;
			border-radius: 28rpx;
			margin-bottom: 20rpx;
			border: 2rpx solid #FFFFFF;

			.title {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 20rpx;
				font-weight: 600;
				font-size: 30rpx;
				color: #1E1617;

				span {
					display: flex;
					flex-wrap: wrap;
					align-items: center;
					font-weight: 400;
					font-size: 26rpx;
					color: #999;

					/deep/.u-icon {
						margin-left: 10rpx;
						color: #999;
					}
				}
			}

			.goods_list {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				align-items: center;
				font-weight: 500;
				font-size: 26rpx;
				color: #EF4539;

				.goods_list_img {
					image {
						width: 116rpx;
						height: 116rpx;
						margin-bottom: 20rpx;
						border-radius: 12rpx;
					}
				}

			}


		}

		.list:nth-child(n+1) {
			background: linear-gradient(180deg, #DFFAFF 0%, #FFFFFF 100%);
		}

		.list:nth-child(3n+1) {
			background: linear-gradient(180deg, #E0FFE9 0%, #FFFFFF 100%);

		}

		.list:nth-child(4n+1) {
			background: linear-gradient(180deg, #FDE5E7 0%, #FFFFFF 100%);

		}

		.list:nth-child(5n+1) {
			background: linear-gradient(180deg, #FCFCE2 0%, #FEFEFF 100%);


		}
	}
</style>